package de.tum.in.eist.poll.server;

import java.util.List;

import junit.framework.TestCase;

import de.tum.in.eist.poll.shared.*;



public class TestDatabase extends TestCase {
	
	public void testEverything(){
		List<Student> stud = Database.getStudents();
		List<Lecturer> lect = Database.getLecturers();
		List<Lecture> lectures = Database.getLectures();
		Lecturer lecturer = (Lecturer) Database.getUser("Maalej");
		
		assertNotNull(stud.get(0));
		assertEquals("Student_1", stud.get(0).getName());
		assertEquals("new", stud.get(0).getPassword());
		
		assertNotNull(stud.get(1));
		assertEquals("Student_2", stud.get(1).getName());
		assertEquals("new", stud.get(1).getPassword());
		
		assertNotNull(lect.get(0));
		assertEquals("Prof", lect.get(0).getName());
		assertEquals("new", stud.get(0).getPassword());
		
		assertNotNull(lect.get(1));
		assertEquals("Maalej", lect.get(1).getName());
		assertEquals("new", lect.get(1).getPassword());
		
		assertNotNull(lectures.get(0));
		assertEquals("IN0001", lectures.get(0).getLectureID());
		assertEquals("EIST_1", lectures.get(0).getLectureTitle());
		assertEquals(lecturer, lectures.get(0).getLecturer());
		
		
		//Writing only works once!
		/*Feedback feed =  new Feedback(lectures.get(0), stud.get(0), 3, "Kein Englisch!!!", "Netter Typ!?!");
		Database.addFeedbackToLecture(lectures.get(0), feed);
		
		assertNotNull(Database.getFeedback(lectures.get(0)).get(0));
		assertEquals(feed, Database.getFeedback(lectures.get(0)).get(0));	*/
		
		
	}

}
